----------------------------------------------------------------
-- @name: index_full_scan
-- @author: dion cho
-- @description: test for index full scan
-----------------------------------------------------------------

drop table t1 purge;

create table t1(c1 int, c2 int);

create index t1_n1 on t1(c1);

insert into t1
select level, level
from dual
connect by level <= 10000
;

commit;

@gather t1

explain plan for
select /*+ index(t1) */
  c1
from t1
;

@plan

explain plan for
select 
  c1
from t1
order by c1
;

@plan

alter table t1 modify c1 not null;

explain plan for
select /*+ index(t1) */
  c1
from t1
;

@plan

explain plan for
select 
  c1
from t1
order by c1
;

@plan


-- min / max problem
explain plan for
select /*+ index(t1) */
  max(c1) 
from t1
;

@plan

explain plan for
select /*+ index(t1) */
  max(c1) 
from t1
where c1 > 1
;

@plan


explain plan for
select /*+ index(t1) */
  min(c1), max(c1)
from t1
;

@plan

explain plan for
select /*+ index(t1) */
  min(c1) 
from t1
union all
select /*+ index(t1) */
  max(c1) 
from t1
;

@plan
